#ifndef LISTDIAGRAM_HH
#define LISTDIAGRAM_HH


#include <QGraphicsView>
#include <QGraphicsScene>
#include <QGraphicsItem>
#include <QGraphicsSimpleTextItem>
#include <QList>

namespace dsa
{

class Node;

class ListTextItem : public QObject,
                     public QGraphicsItemGroup
{
  Q_OBJECT
public:
  enum Elements
  {
    Element_Color,
    Element_Size,
    Element_Name,
    Element_COUNT
  };

private:
  dsa::Node *_node;

  QGraphicsItem *_items [Element_COUNT];


private slots:
  void EnableHover (bool enable);

public:
  ListTextItem ();

  unsigned GetWidth (Elements element) const;
  unsigned GetHeight () const;

  void SetSizes (unsigned color, unsigned size);


  void SetNode (dsa::Node *node);
};

class ListDiagram : public QGraphicsView
{
  Q_OBJECT
private:
  QList<dsa::ListTextItem*> _items;

  QGraphicsScene  *_scene;
public:
  ListDiagram(QWidget *parent = 0);

  void Set (dsa::Node* node, QList<dsa::Node*> nodes);

signals:
  void ChangeDirectory (dsa::Node* node);

};

}
#endif // LISTDIAGRAM_HH
